Welcome to Javascript Tips and Tricks

Home
Science Department
Health Department
Math Department
Grade 9 Adolescence
Grade 7 Technology
HTML Guide
Javascript
LD Department
Photo Gallery
Links
Contact Me
    Navigation and Browser Effects Home Alerts, Prompts, Confirms, etc.
    Tips and Tricks Time and Date Scripts Other Types All the Scripts

    Here are some tips for you other javascripters.

    [Identifing Javascripts] [Commenting Out Words] [Hiding the Script]

    Identifing Javascripts

    You should always place the "language='javascript'" command in the <script> tag so that the browser will understand that it is Javascript. This is because there are other types of scripts.

    <script language="javascript">

    </script>

    Commenting Out Text

    You should comment out text inside a javascript to tell you what is does and that is was created by you. There are 2 ways:

    <script language="javascript">

    /*
    These star-slashes comment out everything inbetween them
    */

    // This comments out everything on the same line

    </script>

    Hiding the Script

    There are still some browsers that do not understand Javascript. Also some people disable it. So when they load the page, they see gibberish written all over the screen. To avoid this, do as below.

    <script language="javascript">

    <!--

    /*
    Remember to place them IN the scripts otherwise it will remove the script completely
    Notice the // before the -->. Without it, the javascript will see it as an error.
    */

    //-->

    </script>

    [Identifing Javascripts] [Commenting Out Words] [Hiding the Script]